package com.jobs.generic;

import java.util.Arrays;
import java.util.Collections;

/**
 * @Author 王博
 * @DateTime 2024-08-15 13:22
 */
public class GenericMain {
    public static void main(String[] args) {
        GenericClassDemo<String> genericDemo = new GenericClassDemo<>("string");
        System.out.println(genericDemo.getKey());

        GenericClassDemo<Integer> genericDemo1 = new GenericClassDemo<>(1);
        System.out.println(genericDemo1.getKey());

        GenericClassDemo genericDemo2 = new GenericClassDemo(100);
        System.out.println(genericDemo2.getKey());


        GenericChildClassDemo genericChildClassDemo = new GenericChildClassDemo("string");
        String key = genericChildClassDemo.getKey();
        System.out.println(key);


        GenericChild2ClassDemo<String> genericChild2ClassDemo = new GenericChild2ClassDemo<>("字符串");
        String key1 = genericChild2ClassDemo.getKey();
        System.out.println(key1);

        GenericMethodDemo genericMethodDemo = new GenericMethodDemo();
        System.out.println(genericMethodDemo.get(Collections.singletonList("string")));
    }
}
